package deepbrain.simnetwork.demo;

import deepbrain.simnetwork.engine.SimEngine;
import deepbrain.simnetwork.engine.SimpleSimEngine;
import deepbrain.simnetwork.loader.NetworkLoader;
import deepbrain.simnetwork.loader.xml.XmlNetworkLoader;
import deepbrain.simnetwork.mechanism.Mechanism;
import deepbrain.simnetwork.mechanism.PLoSHopfieldMechanism;
import deepbrain.simnetwork.monitor.DisplayNetworkMonitor;
import deepbrain.simnetwork.network.Network;
import deepbrain.simnetwork.network.NetworkState;
import deepbrain.simnetwork.task.SimulationTask;

/**
 * Simulation of Balduzzi-Tononi PLoS Paper Figure18 [Hopfield Network]
 * 
 * @author Li Yang
 * @create 2009-2-30
 */
public class PLoSFig18 {

	private static final int NUM_OF_STEPS = 100;

	public static void main(String[] args) throws Exception {
		NetworkLoader loader = new XmlNetworkLoader(
				"networks/PLoS-fig18.xml");
		Network network = loader.loadNetwork();

		SimulationTask task = new SimulationTask() {
			@Override
			public void runTask() {
				runForSteps(NUM_OF_STEPS);
			}
		};
		
		task.setNetwork(network);
		task.setNetworkState(NetworkState.loadNetworkState("00000000"));
		task.addMonitor(new DisplayNetworkMonitor());

		Mechanism mechanism = new PLoSHopfieldMechanism(0.35);
		network.setMechanism(mechanism);

		SimEngine engine = new SimpleSimEngine();
		engine.runTask(task);
	}
}
